From: Karl Heuer Date: Thu, 18 Aug 1994 21:03:37 +0000 (+0000) Subject: (split-window-horizontally): If size is negative, measure from the right. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~90497 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=0ef2c2f2e63e6d5e173b076bca140ef0bc112df3;p=emacs.git (split-window-horizontally): If size is negative, measure from the right. --- diff --git a/lisp/window.el b/lisp/window.el index bab282a265c..4ebe8b50e41 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -124,10 +124,14 @@ new mode line." (defun split-window-horizontally (&optional arg) "Split current window into two windows side by side. -This window becomes the leftmost of the two, and gets -ARG columns. No arg means split equally." +This window becomes the leftmost of the two, and gets ARG columns. +Negative arg means select the size of the rightmost window instead. +No arg means split equally." (interactive "P") - (split-window nil (and arg (prefix-numeric-value arg)) t)) + (let ((size (and arg (prefix-numeric-value arg)))) + (and size (< size 0) + (setq size (+ (window-width) size))) + (split-window nil size t))) (defun enlarge-window-horizontally (arg) "Make current window ARG columns wider."